/*
============================================================================
Name		: KeyBoard.h
Author	  : emoney
Version	 : 1.0
Copyright   :
Description : CKeyBoard declaration
============================================================================
*/

#ifndef KEYBOARD_H
#define KEYBOARD_H

// INCLUDES
#include <e32std.h>
#include <e32base.h>
#include <bitstd.h>		//CFbsBitGc
// CLASS DECLARATION

#define FASTCODE1 9901
#define FASTCODE2 9902
#define FASTCODE3 9903
#define FASTCODE4 9904
#define FASTCODE5 9905

struct TMyKey
{
	TMyKey() {}
	TMyKey(const TInt& nID, const TDesC& aName,const TRect& rect);

	TInt m_nID;
	TRect m_Rect;
	TBuf<4> m_Name;
};

/**
*  CKeyBoard
* 
*/
class CKeyBoard : public CBase
{
public:
	enum TInputType
	{
		NUMERIC,
		LETTER,
		NUMERICANDLETTER,
		PASSWORD,
		DECIMAL,
	};
	
public:
	~CKeyBoard();

	static CKeyBoard* NewL();

	static CKeyBoard* NewLC();

public:
	void Draw(CFbsBitGc&  g);

	TBool OnMouseDown(const TPoint& aPt);

	TBool OnMouseUp(const TPoint& aPt);

	void OnMouseMove(const TPoint& aPt);

	void OnSize(const TRect& aRect);

	static TInt OnTimer(TAny* aAny);

	void InitKeys();
	
	void SetInputType(TInputType aInputType);

private:
	TBool CheckKey(const TPoint& aPt);

	const TDesC& GetKeyString(TInt aCode);

private:
	CKeyBoard();

	void ConstructL();

public:
	
	TRect m_Rect;
	TRect m_RectInput;
	TBuf<64> m_strInput;
	TBool m_bRepaintAll;
	TBool m_bInputGoodCode;
	TInt8 m_InputLength;
	TBool m_bSearchGood;

private:
	TInt m_nHeight;
	TInt m_nMouseID;
	TBool	m_bNum;
	RArray<TMyKey> m_aKey;
	TBuf<16> m_strInputDecl;
	TBool m_isShowZoom;
	TInputType iInputType;
};

#endif // KEYBOARD_H
